package org.lvhengchang.schoolmanager.dao;

import java.sql.SQLException;
import java.util.List;

import javax.sql.DataSource;

import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;
import org.lvhengchang.schoolmanager.bean.Dict;
import org.lvhengchang.schoolmanager.bean.Student;
import org.lvhengchang.schoolmanager.util.DataSourceTools;

public class DictDao {
	private DataSource dataSource = DataSourceTools.getDataSource();
	private final static String DICT_SQL = 
			"select dict_code_id, dict_type_id, dict_code_name from t_dict_code";
	
	 public List<Dict> selectAll() throws SQLException {
	        QueryRunner queryRunner = new QueryRunner(dataSource);
	        List<Dict> dicts = queryRunner.query(DICT_SQL,
	                new BeanListHandler<Dict>(Dict.class));
	        return dicts;
	    }

}
